package com.finace.money.ui.activity;

import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.finace.money.R;
import com.finace.money.common.util.UIUtil;
import com.finace.money.data.bean.AccountInfoBean;
import com.finace.money.di.component.AppComponent;
import com.finace.money.net.socket.PushReceiver;

import butterknife.BindView;

/**
 * Created by zhangpeng on 2017/11/28.
 */

public class AccountDetailActivity extends BaseActivity implements View.OnClickListener {
    @BindView(R.id.rl_left)
    RelativeLayout rlLeft;
    @BindView(R.id.tv_head_title)
    TextView tvHeadTitle;
    @BindView(R.id.tv_power)//当前权益
    TextView tvPower;
    @BindView(R.id.tv_money_use)//可用资金
    TextView tvMoneyUse;
    @BindView(R.id.tv_profit_and_loss)//盈亏
    TextView tvProfitAndLoss;
    @BindView(R.id.tv_profit_and_loss_clean)//平仓盈亏
    TextView tvProfitAndLossClean;
    @BindView(R.id.tv_profit_and_loss_have)//持仓盈亏
    TextView tvProfitAndLossHave;
    @BindView(R.id.tv_money_charge)//手续费
    TextView tvMoneyCharge;
    @BindView(R.id.tv_money_bond)//占用保证金
    TextView tvMoneyBond;
    @BindView(R.id.tv_money_bond_cord)//冻结保证金
    TextView tvMoneyBondCord;
    @BindView(R.id.tv_money_out_today)//今日出金
    TextView tvMoneyOutToday;
    @BindView(R.id.tv_money_in_today)//今日入金
    TextView tvMoneyInToday;

    @Override
    public int setLayout() {
        return R.layout.activity_account_detail;
    }

    @Override
    public void init() {
        tvHeadTitle.setText(UIUtil.getString(R.string.account_detail));
        rlLeft.setOnClickListener(this);
        AccountInfoBean accountInfoBean = (AccountInfoBean) getIntent().getSerializableExtra(PushReceiver.ACTION_ACCOUNT_INFO);
        if (null != accountInfoBean) {
            tvPower.setText(accountInfoBean.getNow_equity());
            tvMoneyUse.setText(accountInfoBean.getAvabileFunds());
            tvProfitAndLoss.setText(accountInfoBean.getProfit());
            tvProfitAndLossClean.setText(accountInfoBean.getUnrealizedpl());
            tvProfitAndLossHave.setText(accountInfoBean.getRealizedpl());
            tvMoneyCharge.setText(accountInfoBean.getCommission());
            tvMoneyBond.setText(accountInfoBean.getFutMarginUsed());
            tvMoneyBondCord.setText(accountInfoBean.getFutMarginFrozen());
            tvMoneyOutToday.setText(accountInfoBean.getWithdraw());
            tvMoneyInToday.setText(accountInfoBean.getDeposit());
        }
    }

    @Override
    public void setupAcitivtyComponent(AppComponent appComponent) {

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.rl_left:
                onBackPressed();
                break;
        }
    }

}
